#ifndef SOCKETS_HPP
#define SOCKETS_HPP

#if defined(WIN32) || defined(_WIN32)
#define SCK_WIN32
#endif

#include "netaddress.hpp"
#include "udpsocket.hpp"
#include "tcpsocket.hpp"

#include <exception>
#include <string>

#ifdef SCK_WIN32
void initSockets();
void shutdownSockets();
#else
inline void initSockets() {}
inline void shutdownSockets() {}
#endif

class SocketException : public std::exception
{
	public:

	~SocketException() throw() {};
	
	virtual const char* what() const throw();
	int getError() const;
	
	private:
	
	SocketException( int error_ );
	
	friend class UdpSocket;
	friend class NetAddress;
	friend class TcpSocket;
	
	int error;
	std::string whatStr;
};

#endif // SOCKETS_HPP
